package com.p2p.auth;

import com.p2p.auth.config.RedisPool;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableEurekaClient
@EnableAutoConfiguration
@SpringBootApplication
@EnableFeignClients
@EnableCircuitBreaker //使用断路器
@EnableScheduling
@EnableHystrix
@EnableHystrixDashboard
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Value("${redis.pool.maxActive}")
    public void setPoolMaxActive(String poolMaxActive) {
        RedisPool.poolMaxActive = poolMaxActive;
    }
    @Value("${redis.pool.maxIdle}")
    public void setPoolMaxIdle(String poolMaxIdle) {
        RedisPool.poolMaxIdle = poolMaxIdle;
    }
    @Value("${redis.pool.maxWait}")
    public void setPoolMaxWait(String poolMaxWait) {
        RedisPool.poolMaxWait = poolMaxWait;
    }
    @Value("${redis.ip}")
    public void setIp1(String ip1) {
        RedisPool.ip1 = ip1;
    }
    @Value("${redis.port}")
    public void setPort1(String port1) {
        RedisPool.port = port1;
    }
    @Value("${redis1.ip}")
    public void setIp2(String ip2) {
        RedisPool.ip2 = ip2;
    }
    @Value("${redis1.ip}")
    public void setIp3(String ip3) {
        RedisPool.ip3 = ip3;
    }
}
